﻿using RayDen.RayEngine.Core.Interface;
using RayDen.RayEngine.Samplers;

namespace RayDen.RayEngine.Engines.PathTracer.AdjointPhotonTracer
{
    [RenderingEngine(EngineType = RenderingEngines.Apt)]
    public class AdjointPhotonTracerEngine : BaseRenderingEngine
    {
        public AdjointPhotonTracerEngine(RayEngineScene scene) : base(scene)
        {
        }

        public override Core.Threads.RenderThread CreateRenderThread(int threadIndex, Core.Devices.IntersectionEngine intersectionDevice, RayEngineScene scene, IImageFilm film, Managers.IFrameManager manager, Core.SamplingContext samplingContext)
        {
            return new DeviceRenderThread<PathBuffer<AptPathSampler>>(threadIndex, intersectionDevice, scene,
                GlobalConfiguration.Instance.LowLatency, film, samplingContext, manager);
        }

        public override ISampler CreateSampler(int width, int height, int maxPathDepth, int threadIndex, int screenStartLine, int windowHeight)
        {
            return SamplerFactory.Instance.CreateSampler(width, height, maxPathDepth, screenStartLine, LowLatencySampling,
                                                  threadIndex, windowHeight);
        }

        public override IImageFilm CreateFilm(int width, int height)
        {
            return new ImageFilm<AptPathSampler>(width, height);
        }
    }
}
